/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package taikai;

import java.util.ArrayList;
import javax.swing.AbstractListModel;


public class Teams extends AbstractListModel implements TeamsOrPlayers {
    private final ArrayList<Team> teams = new ArrayList<Team>();

    public void add(Team team) {
        teams.add(team);
        fireContentsChanged(team, teams.size(), teams.size());
    }

    @Override
    public int getSize() {
        return teams.size();
    }

    @Override
    public Object getElementAt(int i) {
        return getTeam(i);
    }

    public Team getTeam(int i) {
        return teams.get(i);
    }

    @Override
    public TeamOrPlayer getTeamOrPlayer(int i) {
        return getTeam(i);
    }

}
